@use "./styleFunction.scss" as tools;
.virtual-table {
    height: 100%;

    :global {
        .ant-spin-nested-loading {
            height: 100%;
        }

        .ant-spin-container {
            height: 100%;
        }

        .ant-spin {
            color: var(--Colors-Use-Main-Primary);
        }

        .ant-spin-dot-item {
            background-color: var(--Colors-Use-Main-Primary);
            color: var(--Colors-Use-Main-On-Primary);
        }
    }

    .virtual-table-heard-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;

        .virtual-table-heard-right-item {
            display: flex;
            align-items: center;

            .virtual-table-heard-right-text {
                color: var(--Colors-Use-Neutral-Disable);
                font-size: 12px;
                margin-right: 4px;
            }

            .virtual-table-heard-right-number {
                color: var(--Colors-Use-Main-Primary);
                font-size: 12px;
            }
        }
    }

    .virtual-table-body {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: hidden;
        position: relative;

        .virtual-table-container-none-select {
            user-select: none !important;
        }

        .virtual-table-col {
            position: sticky;
            display: flex;
            top: 0;
            left: 0;
            width: 100%;
            z-index: 4;
            border-bottom: 1px solid var(--Colors-Use-Neutral-Border);
            width: fit-content;

            .virtual-table-title {
                position: relative;
                display: flex;
                flex-direction: row;
                justify-content: space-between;
                align-items: center;
                background-color: var(--Colors-Use-Neutral-Bg-Hover);
                padding: 6px 12px;
                height: 28px;
                border-right: 1px solid var(--Colors-Use-Neutral-Border);
                width: 100%;
                color: var(--Colors-Use-Neutral-Text-1-Title);
                font-weight: 500;
                font-size: 12px;
                box-sizing: border-box;

                &:last-child {
                    border-right: 0;
                }

                .virtual-title {
                    display: flex;
                    align-items: center;
                    gap: 4px;
                    width: 100%;
                    flex: 1;

                    .icon-question {
                        color: var(--Colors-Use-Neutral-Disable);
                    }
                }

                .virtual-table-title-left {
                    box-shadow: 4px 0px 8px var(--Colors-Use-Basic-Shadow);
                }

                .virtual-table-title-icon {
                    margin-left: 4px;
                    display: flex;
                    align-items: center;
                    justify-content: flex-end;

                    svg {
                        cursor: pointer;

                        &:hover {
                            color: var(--Colors-Use-Main-Primary);
                        }

                        &:active {
                            color: var(--Colors-Use-Main-Pressed);
                        }
                    }

                    .virtual-table-sorter {
                        display: flex;
                        color: var(--Colors-Use-Neutral-Disable);
                    }

                    .virtual-table-sorter-active {
                        color: var(--Colors-Use-Main-Primary);
                    }

                    .virtual-table-filter {
                        color: var(--Colors-Use-Neutral-Disable);
                        display: flex;
                        align-items: center;
                    }

                    .virtual-table-filter-value {
                        color: var(--Colors-Use-Main-Primary);
                    }

                    .virtual-table-sorter-disable {
                        display: flex;
                        color: var(--Colors-Use-Neutral-Border);
                    }
                }
            }

            .virtual-table-title-middle {
                height: 32px;
                padding: 8px 12px;
            }

            .virtual-table-title-fixed-left {
                position: sticky;
                z-index: 5;
                left: 0;
                top: 0;
                box-shadow: 4px 0px 6px var(--Colors-Use-Basic-Shadow);
            }

            .virtual-table-title-fixed-left-box-show-none {
                box-shadow: none !important;
            }

            .virtual-table-title-fixed-left-border {
                &:first-child {
                    border-left: 1px solid var(--Colors-Use-Neutral-Border);
                }

                &:last-child {
                    border-right: 0;
                }
            }

            .virtual-table-title-fixed-right {
                position: sticky;
                z-index: 5;
                right: 0;
                top: 0;

                &:first-child {
                    border-left: 1px solid var(--Colors-Use-Neutral-Border);
                }
            }

            .virtual-table-title-fixed-right-border {
                &:last-child {
                    border-right: 0;
                }
            }

            .virtual-table-title + .virtual-table-title-fixed-right:nth-last-child(1) {
                border-left: 1px solid var(--Colors-Use-Neutral-Border);
                box-shadow: -4px 0px 6px var(--Colors-Use-Basic-Shadow);
            }

            .virtual-table-title-fixed-right-left-0 {
                border-left: 0 !important;
                box-shadow: none !important;
            }
        }

        .virtual-table-list-container {
            width: 100%;
            overflow-y: overlay;
            overflow-x: overlay;
            overflow-anchor: none;
            position: relative;
            padding-bottom: 34px;
            border: 1px solid var(--Colors-Use-Neutral-Border);
            background-color: var(--Colors-Use-Basic-Background);
            // pointer-events: none;

            .virtual-table-list {
                display: flex;
                position: relative;
                width: fit-content;
                font-size: 12px;

                .virtual-table-row {
                    display: flex;
                    align-items: center;
                    width: 100%;
                    word-break: break-all;
                    height: 28px;
                    background: var(--Colors-Use-Basic-Background);
                    border: 1px solid var(--Colors-Use-Neutral-Border);
                    color: var(--Colors-Use-Neutral-Text-1-Title);
                    font-weight: 400;
                    font-size: 12px;
                    box-sizing: border-box;
                    border-bottom-width: 0;
                    z-index: 2;

                    &:first-child {
                        border-top-width: 0;
                    }

                    &:last-child {
                        border-bottom-width: 1px;
                    }
                }

                .virtual-table-row-cell {
                    height: 28px;
                    padding: 6px 12px;
                    width: 100%;
                    border-top: 1px solid var(--Colors-Use-Neutral-Border);
                    display: flex;
                    align-items: center;
                    color: var(--Colors-Use-Neutral-Text-1-Title);

                    &:first-child {
                        border-top-width: 0;
                    }

                    &:last-child {
                        border-bottom: 1px solid var(--Colors-Use-Neutral-Border);
                    }

                    &:hover {
                        background: var(--Colors-Use-Neutral-Bg);
                    }

                    .drag-sort-icon {
                        cursor: move;
                        color: var(--Colors-Use-Neutral-Disable);
                        margin-right: 8px;

                        &:hover {
                            color: var(--Colors-Use-Main-Primary);
                        }
                    }

                    .drag-sort-icon-active {
                        color: var(--Colors-Use-Main-Primary);
                    }

                    &-isDragging {
                        background-color: var(--Colors-Use-Main-Bg);
                    }
                }

                .virtual-table-row-cell-middle {
                    height: 32px;
                    padding: 8px 12px;
                }

                .virtual-table-row-cell-disabled {
                    color: var(--Colors-Use-Neutral-Disable);
                    background-color: var(--Colors-Use-Neutral-Bg-Hover);
                }
                .virtual-table-row-cell-disabled:hover {
                    color: var(--Colors-Use-Neutral-Disable) !important;
                }

                .virtual-table-row-cell-border-right-0 {
                    border-right: 0;
                }

                .virtual-table-row-cell-border-right-1 {
                    border-right: 1px solid var(--Colors-Use-Main-Border);
                }

                .virtual-table-row-cell-border-left-1 {
                    border-left: 1px solid var(--Colors-Use-Main-Border);
                }

                .virtual-table-row-cell-move {
                    cursor: move;
                }

                .virtual-table-row-ellipsis {
                    white-space: nowrap;
                    text-overflow: ellipsis;
                    overflow: hidden;
                    word-break: break-all;
                    width: 100%;
                    line-height: 16px;
                }

                .virtual-table-row-no-ellipsis {
                    display: flex;
                    align-items: center;
                    width: 100%;
                }

                .virtual-table-row-content {
                    height: 100%;
                    background-color: var(--Colors-Use-Basic-Background);
                    border-right: 1px solid var(--Colors-Use-Neutral-Border);

                    &:last-child {
                        border-right: 0;
                    }

                    // &:hover {
                    //     background: var(--Colors-Use-Neutral-Bg-Hover) !important;
                    // }
                }

                .virtual-table-row-fixed-left {
                    position: sticky;
                    left: 0;
                    z-index: 1;
                    box-shadow: none;

                    &:nth-child(n-1) {
                        z-index: 2;
                        box-shadow: 4px 0px 6px var(--Colors-Use-Basic-Shadow);
                    }
                }

                .virtual-table-row-fixed-left-box-show-none {
                    &:nth-child(n-1) {
                        box-shadow: none;
                    }
                }

                .virtual-table-row-fixed-right {
                    position: sticky;
                    right: 0;
                    top: 0;
                    z-index: 1;
                }

                .virtual-table-row-content + .virtual-table-row-fixed-right:nth-last-child(1) {
                    border-left: 1px solid var(--Colors-Use-Neutral-Border);
                    box-shadow: -4px 0px 6px var(--Colors-Use-Basic-Shadow);
                }

                .virtual-table-row-fixed-right-left-0 {
                    border-left: 0 !important;
                    box-shadow: none !important;
                }

                .virtual-table-hover-row {
                    background: var(--Colors-Use-Neutral-Bg);
                    color: var(--Colors-Use-Neutral-Text-1-Title);
                }

                .virtual-table-active-row {
                    border-bottom: 1px solid var(--Colors-Use-Main-Primary) !important;
                    border-top: 1px solid var(--Colors-Use-Main-Primary) !important;
                    background-color: var(--Colors-Use-Main-Bg);
                    color: var(--Colors-Use-Neutral-Text-1-Title);
                }
                .virtual-table-active-row.virtual-table-hover-row {
                    background-color: var(--Colors-Use-Main-Bg);
                    color: var(--Colors-Use-Neutral-Text-1-Title);
                }

                .virtual-table-batch-active-row {
                    background-color: var(--Colors-Use-Main-Bg);
                    position: relative;
                }
                .virtual-table-hover-row.virtual-table-batch-active-row {
                    background-color: var(--Colors-Use-Main-Bg);
                }
                .virtual-table-batch-active-row:not(.virtual-table-batch-active-row ~ .virtual-table-batch-active-row) {
                    border-top: 1px solid var(--Colors-Use-Main-Border) !important;
                }
                .virtual-table-batch-active-row:not(
                        .virtual-table-row-content :has(+ .virtual-table-batch-active-row)
                    ) {
                    border-bottom: 1px solid var(--Colors-Use-Main-Border) !important;
                }

                $allColorTypes: map-keys(tools.$allColors);
                @include tools.generate-permutations-class-name($allColorTypes);

                .virtual-table-active-row + .virtual-table-row-cell {
                    border-top: 0 !important;
                }
            }
        }

        .virtual-table-list-pagination {
            height: 22px;
            position: absolute;
            bottom: 12px;
            width: calc(100% - 10px); // 滚动条宽度

            .pagination-loading {
                height: 22px;
                line-height: 22px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .pagination-text {
                height: 22px;
                line-height: 22px;
                display: flex;
                align-items: center;
                justify-content: center;
                color: var(--Colors-Use-Neutral-Disable);
                font-size: 12px;
                visibility: hidden;
            }

            .pagination-text-show {
                visibility: inherit;
            }
        }

        .virtual-table-list-pagination-border-left {
            border-left: 0;
        }

        .virtual-table-title-drag {
            position: absolute;
            top: 0;
            right: 0;
            width: 5px;
            height: 100%;
            background-color: transparent;
            cursor: col-resize;
            z-index: 4;

            &:hover {
                border-right: 1px solid var(--Colors-Use-Main-Primary);
            }
        }

        .drag-line {
            width: 10px; /** 表格在弹窗里面时，可能线拖拽宽度不够导致onMouseUp事件触发不了 **/
            border-left: 1px dashed var(--Colors-Use-Main-Primary);
            position: absolute;
            z-index: 9;
            height: 100%;

            &:hover {
                cursor: col-resize;
            }
        }

        .check {
            margin-right: 4px;
            height: 16px;
        }

        .virtual-table-row-left {
            text-align: left;
            justify-content: flex-start;
        }

        .virtual-table-row-center {
            text-align: center;
            justify-content: center;
        }

        .virtual-table-row-right {
            text-align: right;
            justify-content: flex-end;
        }

        .virtual-table-flex-center {
            display: flex;
            align-items: center;
        }
    }

    .virtual-table-border-bottom {
        border-bottom: 0;
    }

    .virtual-table-heard {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        height: 42px;
        padding: 8px 0;

        .virtual-table-heard-left {
            display: flex;
            align-items: center;

            .virtual-table-heard-title {
                font-weight: 600;
                font-size: 16px;
                line-height: 24px;
                color: var(--Colors-Use-Neutral-Text-1-Title);
                margin-right: 8px;
            }
        }

        .virtual-table-heard-right {
            flex: 1;
        }
    }
}

.search-popover {
    min-width: 88px;

    :global {
        .ant-popover-inner-content {
            padding: 0;
        }
        .ant-popover-arrow-content {
            border: 1px solid var(--Colors-Use-Neutral-Border);
            background-color: var(--Colors-Use-Basic-Background);
        }
        .ant-popover-arrow-content::before {
            background: none;
        }

        .ant-popover-inner {
            box-shadow: 0px 8px 16px var(--Colors-Use-Basic-Shadow);
            border-radius: 4px;
            border: 1px solid var(--Colors-Use-Neutral-Border);
        }

        .ant-popover-arrow {
            top: 2.514719px;
        }

        .ant-select {
            margin: 0 6px;
        }

        .ant-select:not(.ant-select-customize-input) .ant-select-selector {
            border-radius: 4px;
        }

        .ant-checkbox-inner {
            border-radius: 4px;
        }

        .ant-checkbox-checked::after {
            border-radius: 4px;
        }

        .ant-checkbox-wrapper {
            height: 16px;
        }
    }

    .popover-content {
        padding-top: 8px;
    }

    .select-search {
        position: relative;

        .select-container {
            max-height: 40vh;
            min-height: 34px;
            overflow-y: auto;
            margin-bottom: 4px;
            overflow-anchor: none;
        }

        .select-wrapper {
            padding: 0 4px;
            margin-bottom: 4px;
        }

        .select-item {
            padding: 4px 8px 4px 6px;
            display: flex;
            flex-direction: row;
            align-items: center;
            padding: 6px 12px;
            cursor: pointer;
            border-radius: 4px;
            justify-content: space-between;
            color: var(--Colors-Use-Neutral-Text-1-Title);

            &:hover {
                background: var(--Colors-Use-Neutral-Bg-Hover);
            }

            &:active {
                background: var(--Colors-Use-Neutral-Bg-Hover);
                color: var(--Colors-Use-Main-Primary);
            }
        }

        .no-data {
            display: flex;
            flex-direction: row;
            align-items: flex-start;
            padding: 6px 12px;
            color: var(--Colors-Use-Neutral-Text-1-Title);
        }

        .select-item-active {
            // background: var(--Colors-Use-Neutral-Bg-Hover);
            color: var(--Colors-Use-Main-Primary);
        }

        .select-item-active-single {
            background: var(--Colors-Use-Main-Bg);
            color: var(--Colors-Use-Main-Primary);
        }

        .select-search-single {
            padding: 0 4px;

            .select-search-input {
                padding: 0 6px;
                position: sticky;
                top: 0;
                background-color: #fff;

                :global {
                    .ant-input {
                        border-radius: 4px;
                    }

                    .ant-input-group-addon {
                        display: none;
                        border-radius: 4px;
                    }
                }
            }

            .select-search-input-icon {
                :global {
                    .ant-input {
                        border-top-right-radius: 0;
                        border-bottom-right-radius: 0;
                    }

                    .ant-input-group-addon {
                        display: table-cell;
                        top: -0.5px;
                    }
                }
            }
        }

        .select-search-multiple {
            padding: 0 0 24px 0;
            width: 138px;

            :global {
                ::-webkit-scrollbar {
                    height: 0;
                    width: 0;
                    color: transparent;
                }
            }

            .select-heard {
                position: absolute;
                top: 0;

                :global {
                    .ant-select-selection-overflow {
                        flex-wrap: nowrap;
                        overflow-x: overlay;
                    }
                }
            }
        }

        .select-search-multiple-filterSearch {
            padding: 24px 0;
        }
    }

    .date-time-search {
        padding: 0 8px 8px;

        .time-rang {
            margin-top: 8px;

            span {
                cursor: pointer;
            }
        }
    }

    .date-time-search-footer {
        position: relative;
    }

    @media screen and (max-height: 600px) {
        .select-search {
            max-height: 180px;
        }
    }
}

.justify-content-between {
    display: flex;
    width: 100%;
    justify-content: space-between;
}

.select-footer {
    border-top: 1px solid var(--Colors-Use-Neutral-Border);
    border-radius: 0px 0px 4px 4px;
    width: 100%;
    display: flex;
    background: var(--Colors-Use-Neutral-Bg-Hover);
    height: 28px;
    position: absolute;
    bottom: 0;
    user-select: none;

    .footer-bottom {
        flex: 1;
        font-weight: 500;
        font-size: 12px;
        height: 28px;
        padding: 4px 0;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .select-reset {
        color: var(--Colors-Use-Neutral-Text-1-Title);
        border-right: 1px solid var(--Colors-Use-Neutral-Border);
    }

    .select-sure {
        color: var(--Colors-Use-Main-Primary);
    }
}

.input-search {
    padding: 0 12px 12px 12px;
}

/* 内容过长省略样式 */
.ellipsis-1 {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
}

.check-icon {
    color: var(--Colors-Use-Main-Primary);

    svg {
        height: 16px;
        width: 16px;
    }
}
